/**
 * 
 */
package springbootstudy.thymeleaf;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author Administrator 使用Thymeleaf * pom增加 <dependency>
 *         <groupId>org.springframework.boot</groupId>
 *         <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
 *         2.resource里增加模版文件 3. Controller里返回对应文件
 */
@Controller
@RequestMapping("/thymeleaf")
public class ThymeleafController {
    
	/**
	 * 直接返回
	 * @param map
	 * @return
	 */
	@RequestMapping("/hello")
	public String hello(Map<String, String> map) {
		// 参数名对应模板里名字
		map.put("name", "kitiy");
		return "hello";

	}
   /**
    * 返回ModelAndView
    * @return
    */
	@RequestMapping("/hello1")
	public ModelAndView hello1() {
		// 参数名对应模板里名字
		ModelAndView mv = new ModelAndView();
		mv.getModelMap().put("name", "kitiy1");
		mv.setViewName("hello");
		return mv;
	}
}
